Skip to content

Jujutsu support#302

Draft
jennings wants to merge 16 commits intoasheshgoplani:mainfrom
jennings:jujutsu-support
Draft

Jujutsu support#302
jennings wants to merge 16 commits intoasheshgoplani:mainfrom
jennings:jujutsu-support

Conversation

@jennings
Copy link
Copy Markdown
Contributor

@jennings jennings commented Mar 7, 2026

Adds support for Jujutsu repositories. Jujutsu (jj) is a git-compatible version control system. It has the concept of "workspaces" which are analogous to git worktrees.

Jujutsu repositories can be colocated with git repositories (the .jj directory is a sibiling of the .git directory it uses as its backing storage), so a directory may be both a Git repository and a jj repository. If so, prefer the jj repository.

  • Add a vcs.Backend interface that is implemented by both git.GitBackend and jujutsu.JJBackend.
  • When creating a worktree, prefer instead to create a Jujutsu workspace with jj workspace if in a jj repository.
  • Display in the preview window whether it is a Git Worktree or a Jujutsu Workspace.

@Abeansits
Copy link
Copy Markdown
Contributor

@jennings love the initiative!

Just a couple of questions:

  • how do you avoid the issue of agent's "natural tendency" to use git instead of jj?
  • how do you avoid the issue of having multiple agents pushing (jj git push) to the same repo causing lock contention?

@jennings
Copy link
Copy Markdown
Contributor Author

jennings commented Mar 7, 2026

  • how do you avoid the issue of agent's "natural tendency" to use git instead of jj?

To be honest, I haven't thought that much about it yet. I don't really ask the agent to commit things very often. I know this is a common workflow, though, and people have had success putting instructions in their AGENTS.md to use jj instead of git.

Perhaps it should be a config setting prefer_jujutsu or something, instead of automatically preferring jj workspaces over git worktrees in a colocated repo.

  • how do you avoid the issue of having multiple agents pushing (jj git push) to the same repo causing lock contention?

If you really mean pushing, then I think it has the exact same problems as pushing from a git worktree. Remotes can't tell if git or jj are pushing to them (other than the fact that the commits they're receiving usually have an extra change-id header). In fact, pushing and fetching are actually handled by executing git commands.

However, I think you may mean just "updating the (local) repo with changes", similar to git commit. jj's data structures support concurrent access. However, the underlying git repo doesn't and so jj acquires a lock on it.

@Abeansits
Copy link
Copy Markdown
Contributor

  • how do you avoid the issue of agent's "natural tendency" to use git instead of jj?

To be honest, I haven't thought that much about it yet. I don't really ask the agent to commit things very often. I know this is a common workflow, though, and people have had success putting instructions in their AGENTS.md to use jj instead of git.

Perhaps it should be a config setting prefer_jujutsu or something, instead of automatically preferring jj workspaces over git worktrees in a colocated repo.

nice! the flag you mention seems like a must, we can't have a mix of worktrees and workspaces in the same repo, right? this is explicitly forbidden in the docs for jj

  • how do you avoid the issue of having multiple agents pushing (jj git push) to the same repo causing lock contention?

If you really mean pushing, then I think it has the exact same problems as pushing from a git worktree. Remotes can't tell if git or jj are pushing to them (other than the fact that the commits they're receiving usually have an extra change-id header). In fact, pushing and fetching are actually handled by executing git commands.

However, I think you may mean just "updating the (local) repo with changes", similar to git commit. jj's data structures support concurrent access. However, the underlying git repo doesn't and so jj acquires a lock on it.

sorry didn't explain myself very well, to my understanding if you're using workspaces in a co-located repo, while having multiple agents making changes then jj is forced to sync w the underlying git repo on every change, thus creating potential lock contention in the git store
I might be missing something here, but it seems like this is what the docs are referring to in this section

does that make more sense?

@jennings
Copy link
Copy Markdown
Contributor Author

jennings commented Mar 7, 2026

we can't have a mix of worktrees and workspaces in the same repo, right? this is explicitly forbidden in the docs for jj

You can use worktrees and workspaces in the same repo. I am doing it today with Agent Deck and other similar tools.

What I think you're referring to is that only the default workspace (the first one you get when you jj git clone) can be colocated with git. Any additional workspaces are not colocated, so git commands can't be used in them. It still stores everything in the git repo, it just isn't a git worktree.

This isn't a fundamental limitation, I expect this feature to be added sometime. Several people have started work to make workspaces also contain git worktrees, but it seems it's more work than you'd expect.

while having multiple agents making changes then jj is forced to sync w the underlying git repo on every change, thus creating potential lock contention in the git store

I think you might be worried that every change to any file might trigger a snapshot (amend the working copy commit).

There is no daemon watching files on disk get changed, by default. Instead, each time you run any jj command, the first thing jj does is the equivalent of git commit --amend -A. So, the sync only happens when the agent or human chooses to run a jj command. This is the same amount of contention that git worktrees have because they're all operating on the same object and ref storage.

There is an optional integration with watchman to automatically snapshot when files are edited, but it's not on by default.

I might be missing something here, but it seems like this is what the docs are referring to in this section

I think this is the same problem you'd have using git over NFS, no? The jj storage should be safe over NFS, the warning is referring to git not being fully safe to use concurrently.

@Abeansits
Copy link
Copy Markdown
Contributor

ty @jennings for patiently answering all my n00b questions around jj :)

@jennings
Copy link
Copy Markdown
Contributor Author

jennings commented Mar 8, 2026

It's all good, I just want more people to learn about jj 🙂

If you're interested, come join our Discord. We're a friendly bunch and newcomer questions are welcome.

@jennings
Copy link
Copy Markdown
Contributor Author

jennings commented Mar 12, 2026

I intend to complete and publish this, but I want to refactor the implementation first. I don't like that GitBackend and JJBackend are currently just thin proxies around package-level functions, I think the functions should be folded into the methods.

I've done that work, but just haven't found the time to really vet it and make sure it's not doing anything crazy.

In the meantime, feel free to close this draft PR if it's a nuisance.

asheshgoplani and others added 14 commits March 18, 2026 18:28
…hgoplani#366)

Check existing terminal-features before appending to avoid duplicates
that balloon the list to 260+ entries over multiple session starts.

Committed by Ashesh Goplani
When the name field is left empty, a random adjective-noun name (e.g.,
"golden-eagle") is shown as a dimmed placeholder and used on submit.
The worktree branch placeholder also reflects the generated name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Branch shows as dimmed placeholder (not filled input) when using
  generated name; only fills when user types a custom name
- Align Validate() and GetValuesWithWorktree() branch derivation logic
- Add tests for generated name fallback, branch placeholder behavior,
  and worktree branch derivation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nal-features-spam

Fix asheshgoplani#366: prevent terminal-features spam by checking before appending
Feat: auto-generate session names as placeholders when name field is empty
…-happy

Feat: add happy wrapper support for Claude and Codex (opt-in via use_happy config)
…ranch

Feat: worktree branch reuse (local+remote) and fzf branch picker via Ctrl+F
…key input

The extended-keys option was set server-wide (`set -sq`), which caused
tmux to activate xterm modifyOtherKeys mode on the outer terminal
(iTerm2, etc.). This persisted even after the tmux option was turned off,
causing Ctrl+R and other modified keys to be sent as escape sequences
that Bubble Tea cannot parse — breaking the recent sessions picker and
other Ctrl-key shortcuts in the dashboard.

Two fixes:
- tmux.go: changed `set -sq extended-keys on` to per-session
  `set-option -t <session> -q extended-keys on` at both call sites
- keyboard_compat.go: also disable xterm modifyOtherKeys (ESC[>4;0m)
  on TUI startup alongside the existing Kitty protocol disable, as a
  defense-in-depth measure

Fixes regression introduced in b427418 (asheshgoplani#342).
Create an abstraction vcs.Backend which abstracts over a working copy.
For now, git.GitBackend is the only implementation.

Instead of calling package functions `git.Foo(repoDir)`, now we
construct a `git.GitBackend` and call `b.Foo()`.
Jujutsu repositories should create a jj workspace instead of a git
worktree. However, the concepts are basically the same.

Jujutsu doesn't actually require creating a named bookmark (branch), but
removing the assumption that every worktree has a named branch would be
a lot of work. To start, we can create and advance a bookmark as we do
with git, then possibly relax that later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants